package chapter06

/**
 * 匿名子类
 */
object Test10_AnnoymousClass {
  def main(args: Array[String]): Unit = {
    val person:Person10 =  new Person10 {
      override var name: String = "pop"

      override def eat(): Unit = println(this.name)
    }
    person.eat()
  }
}

// 定义抽象类
// 匿名子类针对抽象类和接口，很明显，他需要实现方法
abstract class Person10 {
  var name:String
  def eat():Unit
}
